<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8" />
        <link href="__STATIC__/css/login.css" rel="stylesheet" type="text/css">
        <script src="__PUBLIC__/js/jquery-1.8.3.min.js"></script>
        <title>{$tpshop_config.shop_info_store_title}</title>
    </head>
    <body>
        <div class="logintop-box">
            <div id="header">
                <div class="fl"><a href="#"><img src="__STATIC__/img/login/login.png" width="345" height="58" alt="logo"></a></div>
                <!--            <div class="fr"><a href="__ROOT__/Shop" target="_blank">公司商城</a></div>
                            <div class="fr"><a href="__ROOT__/Home" target="_blank">企业官网</a></div>
                            <div class="fr"><a href="#">新手帮助</a></div>-->
            </div>
        </div>
        <div class="login-bg">
            <div class="login-main">
                <div id="main">
                    <div class="Article-box"></div>
                    <div class="Article-box2"></div>
                    <div class="Article-box3"></div>
                    <div class="Article-box4"></div>
                    <div class="login-box">
                        <div class="login-box-bg"></div>
                        <span class="systemlogo">会员登陆</span>
                        <div class="login-tit">
                            <if condition="$web.kg eq 1">
                                <form action="__CONTROLLER__/index" method="post" style="margin:0px; padding:0px" id="loginform" >
                                    <ul>
                                        <li><span class="login-user2"></span>
                                            <input name="account" type="text" id="username" class="login-user" placeholder="请输入账号">
                                        </li>
                                        <li><span class="login-pwd3"></span>
                                            <input name="pwd" type="password" class="login-pwd" placeholder="请输入密码" id="password">
                                        </li>
                                        <li><input name="code" type="text" id="verify_code" class="login-pwd2 fl" placeholder="请输入验证码">
                                            <div class="fr"><img src="{:U('Home/Index/verify')}" onclick="this.src = '__CONTROLLER__/verify?id=' + Math.random();";/></div>
                                        </li>
                                        <li> 
                                            <input type="button" name="Loginbtn" class="login-btn" value="立即登录" onClick="cheklogin()"  onkeydown='if(event.keyCode==13){cheklogin();}'>

                                        </li>
                                        <!--  <li>没有账号 点击&nbsp;<a href="Application/regedit.php" >注册</a>&nbsp;&nbsp;｜&nbsp;&nbsp;忘记密码 点击&nbsp;<a href="">找回</a></li>-->
                                    </ul>
                                </form>
                                <else/>
                                <div style="font-size:25px;color:red;text-align:center;height:230px;line-height:230px;">{$web.kgcontent}</div>
                            </if>
                        </div>
                    </div>
                </div>
            </div>    
        </div>
        <div class="loginbm"> Copyright ©2017,净易生 All Rights Reserved.</a></div>
</body>
</html>
<script>
    document.onkeydown=function(event){ 
e = event ? event :(window.event ? window.event : null); 
if(e.keyCode==13){ 
//执行的方法 
cheklogin();
} 
} 


    function cheklogin()
    {
        var username = $.trim($('#username').val());
        if(username == ''){
            alert('请输入帐号');return;
        }
        var password = $.trim($('#password').val());
        if(password == ''){
            alert('请输入密码');return;
        }
        var referurl = $('#referurl').val();
        var verify_code = $.trim($('#verify_code').val());
        if(verify_code == ''){
            alert('请输入验证码');return;
        }


        $.ajax({
            type: 'post',
            url: '/index.php?m=Home&c=Index&a=do_login&t=' + Math.random(),
            data: {username: username, password: password, referurl: referurl, verify_code: verify_code},
            dataType: 'json',
            success: function (res) {
                // /console.log(res);return false;
                if (res.status == 1) {
                    window.location.href = res.url;
                } else {
                    // alert(res.msg);
                    showErrorMsg(res.msg);
                    verify();
                }
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                showErrorMsg('网络失败，请刷新页面后重试');
            }
        })
    }
    function showErrorMsg(msg) {
        alert(msg);
    }



</script>